{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pickle\n",
    "from datasets import load_from_disk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from datasets import load_from_disk\n",
    "\n",
    "\n",
    "dataset = load_from_disk(\"hydrogen_binary_dataset_11w\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatasetDict({\n",
       "    train: Dataset({\n",
       "        features: ['企业名称', '统一社会信用代码', '经营范围', '一级行业分类', '二级行业分类', '三级行业分类', 'prompt'],\n",
       "        num_rows: 74017\n",
       "    })\n",
       "})"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('output_11w.pkl', 'rb') as f:\n",
    "    output_obj = pickle.load(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# dataset = load_from_disk(\"hydrogen_binary_dataset_11w\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'企业名称': '马鞍山市衡安化工产品贸易有限责任公司', '统一社会信用代码': '91340500MA2TU460XE', '经营范围': '批发（不得存储）甲苯、重苯（苯渣）、焦化苯（轻苯）、二甲苯、洗油、溶剂油、甲醇、苯乙烯、煤焦油、萘、硫磺、蒽油、初馏份、脱酚酚油、甲酚（工业甲酚）、苯酚、二甲酚、邻甲酚、蒽、煤焦沥青、顺丁烯二酸酐、氢氧化钠、硫酸、粗苯、二甲残油、轻油；批发零售化工产品（除危险品、易制毒品）、水处理药剂、润滑油、工矿配件、机电产品、五金建材、消防器材、劳保用品、电子产品、生铁、耐火材料、钢材、办公用品。（依法须经批准的项目，经相关部门批准后方可开展经营活动）', '一级行业分类': '制造业', '二级行业分类': '石油、煤炭及其他燃料加工业', '三级行业分类': '煤炭加工', 'prompt': '你是氢能企业筛选专家，专注于氢能企业的识别和分类。氢能企业通常涉及氢气的生产、储存、运输、加注、使用和销售。以下是氢能企业的关键特征和业务范畴：\\n\\n1. **制氢技术**：拥有化石燃料制氢、电解水或电解槽制氢等技术;\\n2. **储运氢能力**：发展液氢、气氢管道、固体材料储氢、LNG大型储罐等技术和设施;\\n3. **氢能源电池技术**：涉足氢燃料电池，如氢燃料电池汽车、质子交换膜燃料电池等;\\n4. **氢能基础设施**：建设和运营氢能电站、氢能管道、氢能电池等基础设施;\\n5. **氢能产业生态**：涵盖制氢、储氢、加氢、氢能源汽车以及氢能基础设施等多个环节;\\n\\n请基于以上条件，分析以下企业信息，判断其是否属于氢能企业：\\n\\n企业信息：企业名称: 马鞍山市衡安化工产品贸易有限责任公司\\n\\n经营范围: 批发（不得存储）甲苯、重苯（苯渣）、焦化苯（轻苯）、二甲苯、洗油、溶剂油、甲醇、苯乙烯、煤焦油、萘、硫磺、蒽油、初馏份、脱酚酚油、甲酚（工业甲酚）、苯酚、二甲酚、邻甲酚、蒽、煤焦沥青、顺丁烯二酸酐、氢氧化钠、硫酸、粗苯、二甲残油、轻油；批发零售化工产品（除危险品、易制毒品）、水处理药剂、润滑油、工矿配件、机电产品、五金建材、消防器材、劳保用品、电子产品、生铁、耐火材料、钢材、办公用品。（依法须经批准的项目，经相关部门批准后方可开展经营活动）\\n\\n一级行业分类: 制造业\\n\\n二级行业分类: 石油、煤炭及其他燃料加工业\\n\\n三级行业分类: 煤炭加工\\n\\n\\n请给出准确判断结果，并以列表形式返回，如果该企业属于氢能企业，请返回[\"是\"]，否则返回[\"否\"]。'}\n",
      "[\"否\"]\n"
     ]
    }
   ],
   "source": [
    "for raw_data, output in zip(dataset[\"train\"], output_obj):\n",
    "    print(raw_data)\n",
    "    print(output.outputs[0].text.strip())\n",
    "    break"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def deal_output(outputs):\n",
    "    def _is_hydrogen(s):\n",
    "        if '[\"否\"]' in s and '[\"是\"]' not in s:\n",
    "            return 0\n",
    "        if '[\"是\"]' in s and '[\"否\"]' not in s:\n",
    "            return 1\n",
    "        return -1\n",
    "    \n",
    "    cls_res = []\n",
    "\n",
    "    for item in outputs:\n",
    "        output = item.outputs[0].text.strip()\n",
    "        cls = _is_hydrogen(output)\n",
    "        cls_res.append(cls)\n",
    "    return cls_res\n",
    "\n",
    "cls_res = deal_output(output_obj)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "from collections import Counter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Counter({0: 68163, 1: 5658, -1: 196})"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Counter(cls_res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "dataset[\"train\"] = dataset[\"train\"].add_column(\n",
    "            \"predict\",\n",
    "            cls_res\n",
    "        )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Dataset({\n",
       "    features: ['企业名称', '统一社会信用代码', '经营范围', '一级行业分类', '二级行业分类', '三级行业分类', 'prompt', 'predict'],\n",
       "    num_rows: 74017\n",
       "})"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataset[\"train\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "09eb000550f24765b2890df2f0b7bf8b",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Filter:   0%|          | 0/74017 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "yes_dataset = dataset[\"train\"].filter(\n",
    "    lambda x: x[\"predict\"] == 1\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "c2022817a462483bb08207c8840e812e",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Creating CSV from Arrow format:   0%|          | 0/6 [00:00<?, ?ba/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "5575243"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "yes_dataset.remove_columns(\"prompt\").to_csv(\"全国氢能企业.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "328bd9167c134f13bd44f69959604c55",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Creating CSV from Arrow format:   0%|          | 0/1 [00:00<?, ?ba/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "248888"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "other_dataset = dataset[\"train\"].filter(\n",
    "    lambda x: x[\"predict\"] == -1\n",
    ")\n",
    "other_dataset.remove_columns(\"prompt\").to_csv(\"全国氢能企业_other.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "21f22ebc133440a2b7063bf0e70ffa7d",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Filter:   0%|          | 0/74017 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "no_dataset = dataset[\"train\"].filter(\n",
    "    lambda x: x[\"predict\"] != 1\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Dataset({\n",
       "    features: ['企业名称', '统一社会信用代码', '经营范围', '一级行业分类', '二级行业分类', '三级行业分类', 'prompt', 'predict'],\n",
       "    num_rows: 68359\n",
       "})"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "no_dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "f7489fd104a64045ba0719ba9f7da45d",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Filter:   0%|          | 0/74017 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "7a158f3bc2884ae9bb01399ee948621c",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Creating CSV from Arrow format:   0%|          | 0/69 [00:00<?, ?ba/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "72759727"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "no_dataset.remove_columns(\"prompt\").to_csv(\"全国氢能企业_no.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "74017"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(output_obj)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "dataset[\"train\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# dataset[\"train\"] = dataset[\"train\"].add_column(\n",
    "#             \"predict\",\n",
    "#             [\n",
    "#                 item.outputs[0].text.strip()\n",
    "#                 for item in output_obj\n",
    "#             ]\n",
    "#         )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "716d21e2bef942f7b807163fd9291a5b",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Filter:   0%|          | 0/60780 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "other_dataset = dataset[\"train\"].filter(\n",
    "    lambda x: x[\"predict\"] != '[\"是\"]' and x[\"predict\"] != '[\"否\"]'\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Dataset({\n",
       "    features: ['企业名称', '统一社会信用代码', '经营范围', '一级行业分类', '二级行业分类', '三级行业分类', 'labels', 'predict'],\n",
       "    num_rows: 3949\n",
       "})"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "other_dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'企业名称': '安徽恒泰艾普新能源科技有限公司',\n",
       " '统一社会信用代码': '91340500MA2UHNJD0D',\n",
       " '经营范围': '新能源和氢能源商用车、特种车及其动力总成和其它核心零部件的研发、市场推广、销售、技术服务。（依法须经批准的项目，经相关部门批准后方可开展经营活动）',\n",
       " '一级行业分类': '制造业',\n",
       " '二级行业分类': '汽车制造业',\n",
       " '三级行业分类': '汽车整车制造',\n",
       " 'labels': '请你根据下述企业信息，判断该企业是否属于氢能企业：\\n    企业名称: 安徽恒泰艾普新能源科技有限公司\\n\\n经营范围: 新能源和氢能源商用车、特种车及其动力总成和其它核心零部件的研发、市场推广、销售、技术服务。（依法须经批准的项目，经相关部门批准后方可开展经营活动）\\n\\n一级行业分类: 制造业\\n\\n二级行业分类: 汽车制造业\\n\\n三级行业分类: 汽车整车制造\\n\\n\\n    请以list的形式返回结果，若是氢能企业，请返回[\"是\"]，否则返回[\"否\"]。\\n    ',\n",
       " 'predict': '[是]'}"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "other_dataset[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'企业名称': '安徽恒泰艾普新能源科技有限公司',\n",
       " '统一社会信用代码': '91340500MA2UHNJD0D',\n",
       " '经营范围': '新能源和氢能源商用车、特种车及其动力总成和其它核心零部件的研发、市场推广、销售、技术服务。（依法须经批准的项目，经相关部门批准后方可开展经营活动）',\n",
       " '一级行业分类': '制造业',\n",
       " '二级行业分类': '汽车制造业',\n",
       " '三级行业分类': '汽车整车制造',\n",
       " 'labels': '请你根据下述企业信息，判断该企业是否属于氢能企业：\\n    企业名称: 安徽恒泰艾普新能源科技有限公司\\n\\n经营范围: 新能源和氢能源商用车、特种车及其动力总成和其它核心零部件的研发、市场推广、销售、技术服务。（依法须经批准的项目，经相关部门批准后方可开展经营活动）\\n\\n一级行业分类: 制造业\\n\\n二级行业分类: 汽车制造业\\n\\n三级行业分类: 汽车整车制造\\n\\n\\n    请以list的形式返回结果，若是氢能企业，请返回[\"是\"]，否则返回[\"否\"]。\\n    ',\n",
       " 'predict': '[是]'}"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "other_dataset[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "50177"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(other_dataset)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'企业名称': '马鞍山友基贸易有限公司',\n",
       " '统一社会信用代码': '913405005861343472',\n",
       " '经营范围': '批发（不得储存）硝酸钾、亚硝酸钾、硫化钠、硝酸钠、双氧水、氢氧化钠（片碱）、甲醇、乙醇（无水），化工产品（不含危化品及易制毒品）、橡胶制品、日用百货的批发零售，技术服务，劳务派遣（不含境外劳务派遣）。（依法须经批准的项目，经相关部门批准后方可开展经营活动）',\n",
       " '一级行业分类': '制造业',\n",
       " '二级行业分类': '化学原料和化学制品制造业',\n",
       " '三级行业分类': '基础化学原料制造',\n",
       " 'labels': '请你根据下述企业信息，判断该企业是否属于氢能企业：\\n    企业名称: 马鞍山友基贸易有限公司\\n\\n经营范围: 批发（不得储存）硝酸钾、亚硝酸钾、硫化钠、硝酸钠、双氧水、氢氧化钠（片碱）、甲醇、乙醇（无水），化工产品（不含危化品及易制毒品）、橡胶制品、日用百货的批发零售，技术服务，劳务派遣（不含境外劳务派遣）。（依法须经批准的项目，经相关部门批准后方可开展经营活动）\\n\\n一级行业分类: 制造业\\n\\n二级行业分类: 化学原料和化学制品制造业\\n\\n三级行业分类: 基础化学原料制造\\n\\n\\n    请以list的形式返回结果，若是氢能企业，请返回[\"是\"]，否则返回[\"否\"]。\\n    ',\n",
       " 'predict': '[\"否\"]'}"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "other_dataset[10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "no_dataset = dataset[\"train\"].filter(\n",
    "    lambda x: x[\"predict\"] == '[\"否\"]'\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "095ff198923c4cc0a35d945832909870",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Filter:   0%|          | 0/60780 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "yes_dataset = dataset[\"train\"].filter(\n",
    "    lambda x: x[\"predict\"] == 1\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'企业名称': '上海氢朋电气科技有限公司',\n",
       " '统一社会信用代码': '91310104MAC6G8GB53',\n",
       " '经营范围': '一般项目：技术服务、技术开发、技术咨询、技术交流、技术转让、技术推广；储能技术服务；电机及其控制系统研发；货物进出口；技术进出口；先进电力电子装置销售；电池销售；软件开发；软件销售；软件外包服务；机械电气设备销售。（除依法须经批准的项目外，凭营业执照依法自主开展经营活动）',\n",
       " '一级行业分类': '制造业',\n",
       " '二级行业分类': '电气机械和器材制造业',\n",
       " '三级行业分类': '其他电气机械及器材制造',\n",
       " 'labels': '请你根据下述企业信息，判断该企业是否属于氢能企业：\\n    企业名称: 上海氢朋电气科技有限公司\\n\\n经营范围: 一般项目：技术服务、技术开发、技术咨询、技术交流、技术转让、技术推广；储能技术服务；电机及其控制系统研发；货物进出口；技术进出口；先进电力电子装置销售；电池销售；软件开发；软件销售；软件外包服务；机械电气设备销售。（除依法须经批准的项目外，凭营业执照依法自主开展经营活动）\\n\\n一级行业分类: 制造业\\n\\n二级行业分类: 电气机械和器材制造业\\n\\n三级行业分类: 其他电气机械及器材制造\\n\\n\\n    请以list的形式返回结果，若是氢能企业，请返回[\"是\"]，否则返回[\"否\"]。\\n    ',\n",
       " 'predict': '[\"是\"]'}"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "yes_dataset[100]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6654"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(yes_dataset)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Dataset({\n",
       "    features: ['企业名称', '统一社会信用代码', '经营范围', '一级行业分类', '二级行业分类', '三级行业分类', 'labels', 'predict'],\n",
       "    num_rows: 50177\n",
       "})"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "no_dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'企业名称': '鞍山荣强贸易有限公司',\n",
       " '统一社会信用代码': '912103036866301887',\n",
       " '经营范围': '金属材料、五金交电、电气机械及器材、化工产品（不含危险化学品）、橡胶制品、塑料制品、仪器仪表、电子产品、焊条、劳保用品、通用设备、耐火材料、日用杂品（不含烟花爆竹）经销；磷酸、盐酸、硝酸、乙酸、硼酸、硫酸钴、亚硫酸氢钠、氯化钡、氯化钴、氯化镍、硝酸锌、硝酸银、硝酸钾、亚硝酸钠、硫酸镍、高锰酸钾、氢氧化钠、过硫酸铵、四氯化碳、氟锆酸钾、丙酮、乙醇、甲醇、异丙醇、赤磷、氨基磺酸、氟化铵、乙二胺、二甲苯、硫脲批发无储存；经营货物及技术进出口。（依法须经批准的项目，经相关部门批准后方可开展经营活动。）',\n",
       " '一级行业分类': '批发和零售业',\n",
       " '二级行业分类': '批发业',\n",
       " '三级行业分类': '矿产品、建材及化工产品批发',\n",
       " 'labels': '请你根据下述企业信息，判断该企业是否属于氢能企业：\\n    企业名称: 鞍山荣强贸易有限公司\\n\\n经营范围: 金属材料、五金交电、电气机械及器材、化工产品（不含危险化学品）、橡胶制品、塑料制品、仪器仪表、电子产品、焊条、劳保用品、通用设备、耐火材料、日用杂品（不含烟花爆竹）经销；磷酸、盐酸、硝酸、乙酸、硼酸、硫酸钴、亚硫酸氢钠、氯化钡、氯化钴、氯化镍、硝酸锌、硝酸银、硝酸钾、亚硝酸钠、硫酸镍、高锰酸钾、氢氧化钠、过硫酸铵、四氯化碳、氟锆酸钾、丙酮、乙醇、甲醇、异丙醇、赤磷、氨基磺酸、氟化铵、乙二胺、二甲苯、硫脲批发无储存；经营货物及技术进出口。（依法须经批准的项目，经相关部门批准后方可开展经营活动。）\\n\\n一级行业分类: 批发和零售业\\n\\n二级行业分类: 批发业\\n\\n三级行业分类: 矿产品、建材及化工产品批发\\n\\n\\n    请以list的形式返回结果，若是氢能企业，请返回[\"是\"]，否则返回[\"否\"]。\\n    ',\n",
       " 'predict': '[\"否\"]'}"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "no_dataset[100]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RequestOutput(request_id=0, prompt='[gMASK]<sop><|user|>\\n请你根据下述企业信息，判断该企业是否属于氢能企业：\\n    企业名称: 马鞍山市衡安化工产品贸易有限责任公司\\n\\n经营范围: 批发（不得存储）甲苯、重苯（苯渣）、焦化苯（轻苯）、二甲苯、洗油、溶剂油、甲醇、苯乙烯、煤焦油、萘、硫磺、蒽油、初馏份、脱酚酚油、甲酚（工业甲酚）、苯酚、二甲酚、邻甲酚、蒽、煤焦沥青、顺丁烯二酸酐、氢氧化钠、硫酸、粗苯、二甲残油、轻油；批发零售化工产品（除危险品、易制毒品）、水处理药剂、润滑油、工矿配件、机电产品、五金建材、消防器材、劳保用品、电子产品、生铁、耐火材料、钢材、办公用品。（依法须经批准的项目，经相关部门批准后方可开展经营活动）\\n\\n一级行业分类: 制造业\\n\\n二级行业分类: 石油、煤炭及其他燃料加工业\\n\\n三级行业分类: 煤炭加工\\n\\n\\n    请以list的形式返回结果，若是氢能企业，请返回[\"是\"]，否则返回[\"否\"]。\\n    <|assistant|>', prompt_token_ids=[151331, 151333, 151331, 151333, 151336, 198, 113623, 99245, 98366, 99149, 98684, 98870, 3837, 101270, 98711, 98684, 99775, 100088, 103690, 98342, 98684, 28213, 262, 105527, 100695, 25, 18109, 102, 105, 109704, 104919, 100221, 98504, 103353, 98961, 101118, 104084, 271, 102635, 25, 46462, 117, 98345, 9904, 99978, 103143, 7552, 99786, 104806, 5373, 98429, 104806, 9904, 104806, 103585, 63896, 100231, 98392, 104806, 9904, 99062, 104806, 63896, 120956, 104806, 5373, 99407, 98882, 5373, 113575, 98882, 5373, 117743, 5373, 104806, 110417, 5373, 100855, 100231, 98882, 5373, 79438, 246, 5373, 103849, 116543, 5373, 99166, 121, 98882, 5373, 99037, 116245, 99066, 5373, 99715, 108616, 108616, 98882, 5373, 99786, 108616, 9904, 99878, 99786, 108616, 63896, 104806, 108616, 5373, 120956, 108616, 5373, 101614, 99786, 108616, 5373, 99166, 121, 5373, 100855, 100231, 110140, 5373, 99461, 100376, 104157, 98511, 99464, 98465, 238, 5373, 103690, 101800, 105684, 5373, 110507, 5373, 101333, 104806, 5373, 120956, 99782, 98882, 5373, 99062, 98882, 24892, 104278, 102581, 103353, 98961, 9904, 98928, 101415, 98433, 5373, 98807, 98446, 109829, 63896, 98442, 99343, 118670, 5373, 122959, 5373, 98364, 100157, 104962, 5373, 106538, 98961, 5373, 108011, 107348, 5373, 101764, 106921, 5373, 99386, 98502, 102612, 5373, 109010, 5373, 98330, 99292, 5373, 126636, 99425, 5373, 115220, 5373, 125374, 57961, 120700, 3837, 125953, 27771, 98315, 22190, 58119, 98349, 101263, 25, 125933, 98663, 98349, 271, 98511, 22190, 58119, 98349, 101263, 25, 107763, 98882, 5373, 106211, 107270, 106512, 98431, 99878, 271, 98448, 22190, 58119, 98349, 101263, 25, 10231, 227, 97, 102965, 100938, 1406, 262, 108538, 98333, 1607, 103945, 104559, 99312, 3837, 107716, 103690, 98342, 98684, 3837, 98964, 104559, 1183, 98316, 1341, 3837, 102589, 104559, 1183, 99259, 1341, 8994, 257, 151337], prompt_logprobs=None, outputs=[CompletionOutput(index=0, text='\\n[\"否\"]', token_ids=[198, 1183, 99259, 1341, 151336], cumulative_logprob=-0.10110226356479757, logprobs=None, finish_reason=stop, stop_reason=151336)], finished=True, metrics=RequestMetrics(arrival_time=1719566938.6891563, last_token_time=1719566938.6891563, first_scheduled_time=1719566959.5290654, first_token_time=1719566970.1273816, time_in_queue=20.839909076690674, finished_time=1719566970.445441), lora_request=None)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "item"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "llm",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
